﻿<%@ Page Language="C#" MasterPageFile="~/Design/MasterPage/MasterPage.master" AutoEventWireup="true"
    CodeFile="EmployeeDinnerUpdForm.aspx.cs" Inherits="App_Input_EployeeDinnerUpdForm"
    Title="职员订餐" %>

<%@ Register Assembly="ShpmCommon" Namespace="Shpm.System.Web.Control" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script type="text/jscript">

function popUp()
{
window.open('../Commons/DishSearchForm.aspx?ORDER_FOODS=1','DishSearchForm','scrollbars,resizable')

}

function settext(id){
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
           window.document.getElementById('<%=hidFoodsId.ClientID%>').value = id;
      
            theForm.submit();
        }
    }
    
  function checkQuantity(quantityID)
   {
    var quantity = window.document.getElementById(quantityID).value;
   
        if( quantity == "" )
        {
            window.document.getElementById(quantityID).value = window.document.getElementById('<%=hidQuantity.ClientID%>').value;
            window.document.getElementById(quantityID).focus();
			alert("数量不能为空！");	
        }
        else if( quantity.indexOf(".") >= 0 ){
            window.document.getElementById(quantityID).value = window.document.getElementById('<%=hidQuantity.ClientID%>').value;
            window.document.getElementById(quantityID).focus();
			alert("数量只能输入整数！");	
		}
		else if( isNaN(quantity)){
		    window.document.getElementById(quantityID).value = window.document.getElementById('<%=hidQuantity.ClientID%>').value;
		    window.document.getElementById(quantityID).focus();
			alert("数量只能输入数字！");	

		}
		else if( quantity <= 0 ){
		    window.document.getElementById(quantityID).value = window.document.getElementById('<%=hidQuantity.ClientID%>').value;
		    window.document.getElementById(quantityID).focus();
			alert("数量不能小于1！");
		}
        else
        {
            sumPrice()
        }
		
   }
   function sumPrice()
   {
        var strSum=0;
        var sumQuantity =new Array();
        var strPrice=window.document.getElementById('<%=hidPrice.ClientID%>').value;
        var strCid=window.document.getElementById('<%=hidCid.ClientID%>').value;
        var sumPrice=strPrice.split(',');
        var sumCid=strCid.split(',');
        for(var i=0;i<sumCid.length;i++)
        {
            sumQuantity[i]=window.document.getElementById(sumCid[i]).value;
        }
        for(var j=0; j<sumPrice.length;j++)
        {
            strSum = strSum + (sumPrice[j] * sumQuantity[j]);
        }
        
        window.document.getElementById('<%=lblSum.ClientID%>').innerText="小计："+ strSum.toFixed(2) + "元";
   }
   function initArray(){ 
        this.length=initArray.arguments.length 
        for(var i=0;i<this.length;i++) 
        this[i+1]=initArray.arguments[i]
   } 


   function getWeek()
   {
   var date=window.document.getElementById('<%=txtDate.ClientID%>').value;
   var d=new initArray( 
"星期日", 
"星期一", 
"星期二", 
"星期三", 
"星期四", 
"星期五", 
"星期六");



 var today =new Date(date); 
 if(isNaN(today))
 {
 window.document.getElementById('<%=Label1.ClientID%>').innerText="";

 return;
 }
 

  window.document.getElementById('<%=Label1.ClientID%>').innerText=d[today.getDay()+1];
   window.document.getElementById('<%=hidWeek.ClientID%>').value=d[today.getDay()+1];

   
   
   }
   
   
    
  function tempDate(quantityID)
   {
       var quantity = window.document.getElementById(quantityID).value;
       
       window.document.getElementById('<%=hidQuantity.ClientID%>').value =quantity;

   }
   function order()
   {
   if( window.document.getElementById('<%=hidOrderFlg.ClientID%>').value == "FALSE")

   return confirm('订餐之后将无法更改菜单内容\n      是否确定订餐？');
   }
    </script>

    <table>
        <tr>
            <td valign="top" style="width: 50%">
                <table border="0" class="table_border_line">
                    <tr>
                        <td align="left">

                            <script language="javascript" type="text/javascript">
                (new TitleBar('MemberBar', ' 供选择菜单')).showBar();
                            </script>

                        </td>
                    </tr>
                </table>
                <cc1:ComValidator ID="ComValidator1" runat="server" CheckItems-Capacity="32" Visible="false">
                    <cc1:CheckRequiredAttribute Code="E0082" ControlToValidator="txtDate">
                        <cc1:ComAbsParamsAttribute Parameter="用餐日期" />
                    </cc1:CheckRequiredAttribute>
                    <cc1:CheckDateAttribute Code="E0034" ControlToValidator="txtDate" DataFormat="yyyy/mm/dd">
                        <cc1:ComAbsParamsAttribute Parameter="用餐日期" />
                    </cc1:CheckDateAttribute>
                </cc1:ComValidator>
                <table border="0" class="table_border_line">
                    <tr>
                        <td align="center">
                            <table width="100%">
                                <tr>
                                    <td align="right" style="width: 34px">
                                        <span style="color: #ff7300">*</span></td>
                                    <td style="width: 72px">
                                        菜单日期：
                                    </td>
                                    <td style="width: 203px">
                                        <asp:TextBox ID="txtDate" runat="server" Width="105px" onfocus="new Calendar().show(this);"
                                            MaxLength="10" onpropertychange="getWeek()"></asp:TextBox>
                                        <asp:Label ID="Label1" runat="server"></asp:Label></td>
                                    <td style="width: 71px">
                                        用餐时段：</td>
                                    <td style="height: 38px">
                                        <asp:DropDownList ID="dropDinnerType" runat="server" Width="105px" DataTextField="Content"
                                            DataValueField="DictNo">
                                        </asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td align="right" style="width: 34px">
                                    </td>
                                    <td style="width: 72px">
                                        菜式类别：</td>
                                    <td style="width: 203px">
                                        <asp:DropDownList ID="dropType" runat="server" Width="105px" DataTextField="Content"
                                            DataValueField="DictNo">
                                        </asp:DropDownList></td>
                                    <td style="width: 71px">
                                        菜肴分类：</td>
                                    <td>
                                        <asp:DropDownList ID="dropClass" runat="server" Width="105px" DataTextField="Content"
                                            DataValueField="DictNo">
                                        </asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td style="width: 34px; height: 45px">
                                    </td>
                                    <td style="width: 72px; height: 45px;">
                                    </td>
                                    <td colspan="2" align="center" style="height: 45px" valign="bottom">
                                        <asp:Button ID="btnSearch" runat="server" CssClass="button" Text="检 索" Width="74px"
                                            OnClick="btnSearch_Click" /></td>
                                    <td style="height: 45px">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table width="100%">
                                <tr>
                                    <td align="center" style="height: 53px">
                                        <asp:Label ID="LabDate" runat="server" Font-Bold="True" Font-Size="12pt" Font-Italic="False"
                                            Font-Overline="False" Font-Underline="True"></asp:Label>
                                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                        <asp:Label ID="LabTime" runat="server" Font-Bold="True" Font-Size="11pt" Font-Overline="False"
                                            Font-Underline="True"></asp:Label></td>
                                </tr>
                                <tr>
                                    <td align="center" valign="top">
                                        <div style="width: 100%; height: 400px; overflow: auto">
                                            <asp:GridView ID="GridView1" runat="server" CssClass="GridView_table" DataKeyNames="DishId"
                                                AutoGenerateColumns="False" OnRowEditing="GridView1_OnRowEditing" OnRowDataBound="GridView1_RowDataBound"
                                                OnPageIndexChanging="GridView1_PageIndexChanging" Width="100%" BorderWidth="0px"
                                                ShowFooter="True">
                                                <Columns>
                                                    <asp:BoundField HeaderText="编号">
                                                        <ItemStyle CssClass="GridView_item_center" Width="10%" />
                                                        <HeaderStyle CssClass="GridView_head_grayblue" />
                                                    </asp:BoundField>
                                                    <asp:BoundField HeaderText="菜式类别" DataField="TypeName">
                                                        <ItemStyle CssClass="GridView_item_center" Width="20%" />
                                                        <HeaderStyle CssClass="GridView_head_grayblue" />
                                                    </asp:BoundField>
                                                    <asp:BoundField HeaderText="菜肴分类" DataField="ClassName">
                                                        <ItemStyle CssClass="GridView_item_center" Width="20%" />
                                                        <HeaderStyle CssClass="GridView_head_grayblue" />
                                                    </asp:BoundField>
                                                    <asp:BoundField HeaderText="成品菜名" DataField="DishName">
                                                        <ItemStyle CssClass="GridView_item_center" Width="30%" />
                                                        <HeaderStyle CssClass="GridView_head_grayblue" />
                                                    </asp:BoundField>
                                                    <asp:BoundField HeaderText="单价" DataField="DishPrice" DataFormatString="{0:N}" HtmlEncode="False">
                                                        <ItemStyle CssClass="GridView_item_center" Width="10%" />
                                                        <HeaderStyle CssClass="GridView_head_grayblue" />
                                                    </asp:BoundField>
                                                    <asp:CommandField HeaderText="选择" ShowEditButton="True" ButtonType="Image" EditImageUrl="~/images/edit.jpg"
                                                        FooterText="&lt;a href=&quot;#&quot; onclick=&quot;popUp();&quot;&gt;所有菜...&lt;/a&gt;">
                                                        <HeaderStyle CssClass="GridView_head_grayblue" Width="10%" />
                                                        <ItemStyle CssClass="GridView_item_center" />
                                                    </asp:CommandField>
                                                </Columns>
                                                <PagerStyle HorizontalAlign="Right" VerticalAlign="Middle" />
                                                <EmptyDataTemplate>
                                                    <table class="GridView_table" cellspacing="0" id="GridView2_EmptyDataTemplate" border="0">
                                                        <tr>
                                                            <th class="GridView_head_grayblue" scope="col" style="width: 10%;">
                                                                编号</th>
                                                            <th class="GridView_head_grayblue" scope="col" style="width: 20%;">
                                                                菜式类别</th>
                                                            <th class="GridView_head_grayblue" scope="col" style="width: 20%;">
                                                                菜肴分类</th>
                                                            <th class="GridView_head_grayblue" scope="col" style="width: 30%;">
                                                                成品菜名</th>
                                                            <th class="GridView_head_grayblue" scope="col" style="width: 10%;">
                                                                单价</th>
                                                            <th class="GridView_head_grayblue" scope="col" style="width: 10%;">
                                                                选择</th>
                                                        </tr>
                                                    </table>
                                                </EmptyDataTemplate>
                                                <FooterStyle HorizontalAlign="Center" />
                                            </asp:GridView>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
            <td valign="top" style="width: 6992px">
                &nbsp;
            </td>
            <td valign="top" style="width: 49%">
                <table border="0" class="table_border_line">
                    <tr>
                        <td align="left">

                            <script language="javascript" type="text/javascript">
                (new TitleBar('MemberBar', '  订餐信息')).showBar();
                            </script>

                        </td>
                    </tr>
                </table>
                <cc1:ComValidator ID="ComValidator2" runat="server" CheckItems-Capacity="32" Visible="false">
                    <cc1:CheckRequiredAttribute Code="E0082" ControlToValidator="txtMemberNo">
                        <cc1:ComAbsParamsAttribute Parameter="会员" />
                    </cc1:CheckRequiredAttribute>
                    <cc1:CheckRequiredAttribute Code="E0082" ControlToValidator="txtSendAddress">
                        <cc1:ComAbsParamsAttribute Parameter="送餐地址" />
                    </cc1:CheckRequiredAttribute>
                    <cc1:CheckRequiredAttribute Code="E0082" ControlToValidator="txtSendDate">
                        <cc1:ComAbsParamsAttribute Parameter="送餐日期" />
                    </cc1:CheckRequiredAttribute>
                    <cc1:CheckDateAttribute Code="E0034" ControlToValidator="txtSendDate" DataFormat="yyyy/mm/dd">
                        <cc1:ComAbsParamsAttribute Parameter="送餐日期" />
                    </cc1:CheckDateAttribute>
                </cc1:ComValidator>
                <table border="0" class="table_border_line" width="100%">
                    <tr>
                        <td colspan="3" style="height: 254px; border-bottom: silver 1px solid;" valign="top">
                            <div style="width: 95%; height: 200px; overflow: auto">
                                <asp:GridView ID="GridView2" runat="server" CssClass="GridView_table" AutoGenerateColumns="False"
                                    OnRowDataBound="GridView2_RowDataBound" OnRowDeleting="GridView2_OnRowDeleting"
                                    Width="100%" BorderWidth="0px">
                                    <Columns>
                                        <asp:BoundField HeaderText="编号">
                                            <ItemStyle CssClass="GridView_item_center" Width="10%" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" />
                                        </asp:BoundField>
                                        <asp:BoundField HeaderText="菜式类别" DataField="TypeName">
                                            <ItemStyle CssClass="GridView_item_center" Width="15%" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" />
                                        </asp:BoundField>
                                        <asp:BoundField HeaderText="菜肴分类" DataField="ClassName">
                                            <ItemStyle CssClass="GridView_item_center" Width="15%" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" />
                                        </asp:BoundField>
                                        <asp:BoundField HeaderText="成品菜名" DataField="DishName">
                                            <ItemStyle CssClass="GridView_item_center" Width="30%" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" />
                                        </asp:BoundField>
                                        <asp:BoundField HeaderText="单价" DataField="DishPrice" DataFormatString="{0:N}" HtmlEncode="False">
                                            <ItemStyle CssClass="GridView_item_center" Width="5%" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="数量">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                &nbsp;<asp:TextBox ID="quantity" runat="server" Width="43px" MaxLength="5"></asp:TextBox>
                                            </ItemTemplate>
                                            <ItemStyle CssClass="GridView_item_center" Width="15%" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="删除" ShowHeader="False">
                                            <ItemStyle CssClass="GridView_item_center" />
                                            <HeaderStyle CssClass="GridView_head_grayblue" Width="10%" />
                                            <ItemTemplate>
                                                <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Delete"
                                                    ImageUrl="~/images/delete.jpg" Text="" OnClientClick="return confirm('确定删除吗？')" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerStyle HorizontalAlign="Right" VerticalAlign="Middle" />
                                    <EmptyDataTemplate>
                                        <table class="GridView_table" cellspacing="0" id="GridView2_EmptyDataTemplate" border="0">
                                            <tr>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 10%;">
                                                    编号</th>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 15%;">
                                                    菜式类别</th>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 15%;">
                                                    菜肴分类</th>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 30%;">
                                                    成品菜名</th>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 5%;">
                                                    单价</th>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 15%;">
                                                    数量</th>
                                                <th class="GridView_head_grayblue" scope="col" style="width: 10%;">
                                                    删除</th>
                                            </tr>
                                        </table>
                                    </EmptyDataTemplate>
                                </asp:GridView>
                                </div>
                                <asp:Label ID="lblSum" runat="server" Font-Bold="True"></asp:Label></td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 5px; height: 30px">
                        </td>
                        <td style="width: 131px; height: 30px">
                            订餐编号：</td>
                        <td style="height: 30px; width: 349px;">
                            <asp:Label ID="labDinnerId" runat="server"></asp:Label></td>
                    </tr>
                    <tr>
                        <td style="width: 5px; height: 30px;" align="right">
                            <span style="color: #ff7300">*</span></td>
                        <td style="width: 131px; height: 30px;">
                            职员：
                        </td>
                        <td style="height: 30px; width: 349px;">
                            <asp:TextBox ID="txtEmpId" runat="server" MaxLength="4" Width="55px"></asp:TextBox>
                            <asp:TextBox ID="txtEmpName" runat="server" Width="87px" BackColor="#E0E0E0" BorderColor="#E0E0E0"
                                ForeColor="Black" contentEditable="false"></asp:TextBox>
                            <a href="#" onclick="javascript:popupEmployeeSearch('<%=txtEmpId.ClientID%>', '<%=txtEmpName.ClientID %>' );">
                                <img id="searchImg" runat="server" src="../../images/search.jpg" border="0" />
                            </a>
                        </td>
                    </tr>
                    <tr style="display: none;">
                        <td style="width: 5px; height: 28px;" align="right">
                            <span style="color: #ff7300">*</span></td>
                        <td style="width: 131px; height: 28px;">
                            送餐地址：</td>
                        <td style="height: 28px; width: 349px;">
                            <asp:TextBox ID="txtSendAddress" runat="server" MaxLength="11" Width="349px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 5px; height: 28px">
                            <span style="color: #ff7300">*</span>
                        </td>
                        <td style="width: 131px; height: 28px">
                            用餐时段
                        </td>
                        <td style="height: 28px; width: 349px;">
                            <asp:DropDownList ID="dropDinnerType2" runat="server" Width="105px" DataTextField="Content"
                                DataValueField="DictNo">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr style="display: none;">
                        <td style="width: 5px; height: 34px" align="right">
                            <span style="color: #ff7300">*</span></td>
                        <td style="width: 131px; height: 34px">
                            希望送餐时间：</td>
                        <td style="height: 34px; width: 349px;">
                            <asp:TextBox ID="txtSendDate" runat="server" Width="105px" onfocus="new Calendar().show(this);"></asp:TextBox>
                            <asp:DropDownList ID="dropHour" runat="server">
                            </asp:DropDownList>
                            点
                            <asp:DropDownList ID="dropMin" runat="server">
                            </asp:DropDownList>
                            分
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 5px; height: 24px">
                        </td>
                        <td style="width: 131px; height: 24px">
                            其它配餐要求：
                        </td>
                        <td style="height: 24px; width: 349px;">
                            <asp:TextBox ID="txtMemo" runat="server" Height="186px" TextMode="MultiLine" Width="320px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 5px; height: 24px">
                        </td>
                        <td style="width: 131px; height: 24px" align="right">
                            <span style="color: #ff7300">&nbsp; &nbsp; &nbsp;&nbsp; </span>
                        </td>
                        <td style="height: 24px; width: 349px;">
                            <span style="color: #ff7300"></span>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 5px; height: 43px">
                        </td>
                        <td colspan="2" style="height: 43px" align="center" valign="bottom">
                            <asp:Button ID="btnOrder" runat="server" Text="订 餐" CssClass="button" Width="85px"
                                OnClick="btnOrder_Click" OnClientClick="return order();" />&nbsp; &nbsp;<asp:Button
                                    ID="btnBack" runat="server" Text="返 回" CssClass="button" Width="85px" OnClick="btnBack_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="hidWeek" runat="server" />
    <asp:HiddenField ID="hidOrderFlg" runat="server" Value="FALSE" />
    <asp:HiddenField ID="hidMessage" runat="server" />
    <asp:HiddenField ID="hidQuantity" runat="server" />
    <asp:HiddenField ID="hidFoodsId" runat="server" />
    <asp:HiddenField ID="hidPrice" runat="server" />
    <asp:HiddenField ID="hidCid" runat="server" />
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>
</asp:Content>
